<?php
$member = @getUser();
?>

    <div class="width680 left">
    	 <?php echo $this->load->view('_partials/filterbox')?>
    	<div class="detail">
        	<h1><?php echo $item['name']; ?></h1>
            <div id="NewsInfo">
            	<div class="NewsAuthor">
                	<div class="newf">
                    	<div class="detail_time">Đăng lúc: <b><?php echo date('H:i',$item['modifyTime']) ?></b>, ngày <b><?php echo date('d/m/Y',$item['modifyTime']) ?></b> - <a rel="nofollow" href="<?php echo get_post_list_url($item['provinder_id'],0,$item['cat_id'],0,0) ?>"><b><?php echo getLabelProvinder($item['provinder_id'],true); ?></b></a></div>
                        <div class="detail_eye">Đã xem: <b><?php echo $item['hit']; ?></b> . Mã Tin: <b><?php echo $item['id']; ?></b> </div>
                    </div>
					<div class="newr">
                    	<div class="detail_personal"><?php echo getByShop($item['user_id']) ?><span style="margin-left:5px">|</span><span title="Gửi tin nhắn cá nhân tới thành viên <?php echo $user_post['fullname']; ?>" onclick="formSendPMDetail(<?php echo $item['user_id'] ?>,'<?php echo $user_post['fullname']; ?>');return false" class="detail_pm">Gửi tin nhắn</span></div>
                        <div class="detail_email">
                        	<a rel="nofollow" class="a_email" href="mailto:<?php echo $user_post['email']; ?>"><?php echo $user_post['email']; ?></a>
						</div>
                    </div>
                </div>
            </div>
            <div id="NewsInfo1">
            	<div class="NewsAuthor">
            	<div class="left">
                	<div class="left">
<a rel="nofollow" href="http://www.facebook.com/sharer.php?u=<?php echo current_url();?>&t=<?php echo $item['name']; ?>" target="blank" style="text-decoration:none"><div class="facebook">&nbsp;</div></a>

</div>
<div class="left">

<a href="http://twitter.com/intent/tweet?source=sharethiscom&url=<?php echo current_url();?>&text=<?php echo $item['name']; ?>" target="_blank" rel="nofollow">
     <div class="twitter">&nbsp;</div>
</a>
</div>
<div class="left"><a href="https://plus.google.com/share?url=<?php echo current_url();?>" target="_blank" rel="nofollow"><div class="google">&nbsp;</div></a></div>
                </div>
                <div class="right" style="height:24px;line-height:24px;">
                	<a class="icon-print" onclick="window.print()" href="javascript:void(0)" title="Print TINRAOVAT.INFO rao vat" rel="nofollow"><span style="position:relative;top:1px;">In tin</span> </a>&nbsp;&nbsp;
                    <a onclick="javascript:alert('Bạn chưa đăng nhập') " class="icon-star" title="Sao TINRAOVAT.INFO rao vat" rel="nofollow" id="favour2228367">&nbsp;<span>Lưu tin</span></a>&nbsp;&nbsp;
                    <span class="err">
                    	<a href="javascript:void(0)" class="hint icon-notice" rel="nofollow" datafld="alert-<?php echo $item['id']; ?>"> <span>Báo vi phạm</span></a> <div class="report">
                        	<form name="reportForm2228367">
                            	<div id="comment_report2228367" class="sub-report">
                                	<p><input type="radio" checked="checked"  name="radio2228367" value="0"> Spam</p> <p><input type="radio" id="radio2228367" name="radio2228367" value="1"> Thô tục</p>
                                    <p><input type="radio"  name="radio2228367" value="2"> Trùng nội dung</p>
                                    <p><input type="radio" name="radio2228367" value="3"> Sai danh mục</p>
                                    <p class="clearfix bottom">
                                    	<span class="fl">
                                        	<button onclick="report_question_click();" class="submit-dark" type="button">
                                            	<span class="sprite"><em class="sprite">&nbsp; Gửi &nbsp;</em></span>
                                            </button>
                                        </span>
                                        <span class="fr"><a href="javascript:void(0)" class="close1"></a></span>
                                    </p>
                                </div>
                           </form>
                        </div>
                    </span>
                </div>
                </div>
            </div>
        	<div class="content-detail" style="overflow: hidden;width: 720px;"><?php echo $item['content']; ?></div>
            <div class="footer-detail">
           	  <div class="label-new"><?php echo get_breabcrumb($item['provinder_id'],$item['cat_id'],$item['sub_cat_id'],$item['child_cat_id']); ?></div>
          </div>
        </div>
        <!-- begin comment-->
        <div class="showComment">
            <div class="cm-title"><span>Bình luận</span> <h3><?php echo get_category_label($item['child_cat_id'],true).' - '.get_category_label($item['sub_cat_id'],true) ?></h3></div>
            <div class="formComment">
                <div id="mgs"></div>
                <form id="postComment" method="post" action="<?php echo site_url('post/comment') ?>">
                    <div class="clearfix" id="userId" style="display: none;">
                        <span><input type="text" name="phone" value="<?php echo @$member['mobile'] ?>" placeholder="Số điện thoại"></span>
                      <span><input type="text" name="email" value="<?php echo @$member['email'] ?>" placeholder="Email">
                      <input type="hidden" name="parent" value="0">
                      <input type="hidden" name="user_id" value="<?php echo @$member['id'] ?>">
                      <input type="hidden" name="post_id" value="<?php echo @$item['id'] ?>">
                      </span>
                    </div>
                    <div class="clearfix">
                        <div class="cm-avatar"><img src="<?php echo base_url(thumb($member['avatar'],80,80)); ?>" onerror="this.src='medias/images/noavatarx80x80.jpg'"></div>
                        <div class="cm-edit">
                            <textarea name="comment" placeholder="Viết một bình luận"></textarea>
                        </div>
                    </div>
                    <span class="btncomment"></span>
                </form>
            </div>
            <?php
            if(count($comment)>0 && count($comment)>7){
                ?>
                <div class="listComment">
                    <div id="scrollbar1">
                        <div class="scrollbar"><div class="track"><div class="thumb"><div class="end"></div></div></div></div>
                        <div class="viewport">
                            <div class="overview">
                                <div id="show_mess_success"></div>
                                <?php foreach($comment as $key=>$val){
                                        if(empty($val['user_id'])){
                                          $avatar="medias/images/noavatarx44x44.jpg";
                                        }else {
                                        $avatar = getByUser($val['user_id'],3);
                                        }
                                ?>
                                    <div class="itemComment">
                                        <div class="u-avatar"><img src="<?php echo thumb($avatar,44,44); ?>" onerror="this.src='medias/images/noavatarx44x44.jpg'"></div>
                                        <div class="cmInfo">
                                            <div class="mList">
                                                <div class="clear">
                                                    <?php if(!empty($val['user_id'])){
                                                        echo '<a href="#"><span><strong>'.getByUser($val['user_id'],2).'</strong></span></a>';
                                                    }else {
                                                        echo "<span><strong>".$val['phone']."</strong></span>";
                                                    }
                                                    ?>
                                                    <span><?php echo $val['comment'] ?></span>
                                                </div>
                                                <div class="clear" style="padding-top: 2px;">
                                                    <span class="date_reply"><?php echo getRemainingTime($val['createdTime']) ?></span>
                                                    <span class="reply" datafld="<?php echo $val['id']; ?>">Trả lời</span></a>
                                                </div>
                                            </div>
                                            <div class="subAllForm" id="itemComment<?php echo $val['id'] ?>"></div>
                                            <?php
                                            if(count($val['comment'])){
                                                foreach($val['_childrens'] as $key=>$subItem){
                                                    if(empty($subItem['user_id'])){
                                                        $subAvatar="medias/images/noavatarx44x44.jpg";
                                                    }else {
                                                        $subAvatar = getByUser($val['user_id'],3);
                                                    }

                                            ?>
                                                <div class="subItem">
                                                    <div class="subAvatar"><img src="<?php echo thumb($subAvatar,44,44); ?>" onerror="this.src='medias/images/noavatarx44x44.jpg'"></div>
                                                    <div class="subInfo">
                                                        <div class="clear">
                                                            <?php if(!empty($subItem['user_id'])){
                                                                echo '<a href="#"><span><strong>'.getByUser($subItem['user_id'],2).'</strong></span></a>';
                                                            }else {
                                                                echo "<span><strong>".$subItem['phone']."</strong></span>";
                                                            }
                                                                ?>
                                                            <span><?php echo $subItem['comment'] ?></span>
                                                        </div>
                                                        <div class="clear" style="padding-top: 2px;">
                                                            <span class="date_reply"><?php echo getRemainingTime($subItem['createdTime']) ?></span>

                                                        </div>
                                                    </div>
                                                </div>
                                            <?php } } ?>
                                            <div id="show_sub_<?php echo $val['id']; ?>"></div>
                                        </div>
                                    </div>
                                <?php } ?>
                            </div>
                        </div>
                    </div>
                </div>
                <?php  }else { ?>
                    <?php if(count($comment)>0){ echo "111"; ?>
                    <div class="listComment">
                        <div id="show_mess_success"></div>
                        <?php foreach($comment as $key=>$val){?>
                        <div class="itemComment">
                            <div class="u-avatar"><img src="<?php echo thumb($member['avatar'],44,44); ?>"></div>
                            <div class="cmInfo">
                                <div class="clear">
                                    <?php if(!empty($val['user_id'])){
                                    echo '<a href="#"><span><strong>'.getByUser($val['user_id'],2).'</strong></span></a>';
                                }else {
                                    echo "<span><strong>".$val['phone']."</strong></span>";
                                }
                                    ?>
                                    <span><?php echo $val['comment'] ?></span>
                                </div>
                                <div class="clear">
                                    <span class="date_reply">10:57 | 22.12.2012</span>
                                    <span class="reply">Trả lời</span>
                                </div>
                            </div>
                        </div>
                        <?php } ?>
                    </div>
                <?php  } ?>
        </div>
            <?php  } ?>
        <!-- end comment-->
    </div>

        <?php //echo $this->load->view('_partials/right'); ?>


